/**
 * Title :	jFamilyTree generator
 * Description: jFamilyTree generator
 * Version:	provider
 * Copyright (c) 2001-2008
 * Terms of use:see license agreement at http://treebolic.sourceforge.net/en/license.htm
 * Author: Bernard Bou
 * Company: bsys
 */
package jFamilyTree.site;

import java.util.Set;
import java.util.TreeSet;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * Document search
 * 
 * @author Bernard Bou
 */
public class DocumentSearch
{
	/**
	 * Make image list
	 * 
	 * @param thisDocument
	 *        document
	 * @return image list
	 */
	static public Set<String> makeImageList(Document thisDocument)
	{
		Set<String> thisSet = new TreeSet<String>();

		// <img>
		NodeList theseNodes = thisDocument.getElementsByTagName("img"); //$NON-NLS-1$
		for (int i = 0; i < theseNodes.getLength(); i++)
		{
			Element thisImageElement = (Element) theseNodes.item(i);
			String thisImageFile = thisImageElement.getAttribute("src"); //$NON-NLS-1$
			if (thisImageFile != null && !thisImageFile.isEmpty())
				thisSet.add(thisImageFile);
		}
		return thisSet;
	}
}
